package ooap;

/**
 * @author yuisama
 * @date 2022/08/26 10:25
 **/
public class Person {
    public String name;
    public int age;
    public String sex;
    public String eyes;
    public String mouth;
    public String nose;
//    public Person() {
//        System.out.println("自己定义的构造方法，默认的无参构造就不再产生");
//    }
    public Person() {
        System.out.println("Person类的无参构造");
    }

    public Person(String n,int a,String s) {
        name = n;
        age = a;
        sex = s;
    }

    public Person(String n,int a,String s,String y,String m,String no) {
        System.out.println("Person类的有参构造方法");
        name = n;
        age = a;
        sex = s;
        eyes = y;
        mouth = m;
        nose = no;
    }
    public static void main(String[] args) {
        // showPerson方法是成员方法，必须通过对象调用
        // 通过有参构造产生对象，调用构造方法时，就将对象的属性初始化
        Person per1 = new Person("铭哥",18,"男","正常","正常","正常");
        per1.showPerson();
        Person per2 = new Person();

        // 通过无参构造产生对象，调用无参构造方法时，对象属性为默认值，通过具体的对象来一步步设置属性值
//        Person per2 = new Person();
//        per2.name = "彭于晏";
//        per2.age = 20;
//        per2.sex = "男";
//        per2.eyes = "帅";
//        per2.mouth = "帅";
//        per2.nose = "帅";
//        per2.showPerson();
    }

    public void showPerson() {
        System.out.println("姓名为 : " + name + "，年龄为 : " + age + "性别为 : " + sex
                + "，眼睛大小为 : " + eyes + ", 嘴巴大下为 :" + mouth);
    }
}